<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .carousel {
        position: relative;
        width: 800px;
        height: 500px;
        margin: 50px auto;
        border: 2px solid black;
        overflow: hidden;
      }
      .carousel .pic {
        position: absolute;
        left: 0;
        width: 5000px;
        height: 500px;
        /* 添加绑定动画 */
      -webkit-animation: move 10s ease infinite;
      }
      .carousel .pic img {
        float: left;
        width: 800px;
        height: 500px;
      }
      /* 百分比定义动画细节 */
      @keyframes move {
        /* 动画过程，可以添加任意百分比出的动画细节 */
        /* 从头开始，最好保持跟默认样式的状态一致 */
        0% {
          transform: translateX(0);
        }
        33.33% {
          transform: translateX(-800px);
        }
        66.66% {
          transform: translateX(-1600px);
        }
        100% {
          transform: translateX(-2400px);
        }
      }
    </style>
  </head>
  <body>
    <div class="carousel">
      <div class="pic">
        <img src="images/01.jpg" alt="" />
        <img src="images/02.jpg" alt="" />
        <img src="images/03.jpg" alt="" />
        <img src="images/01.jpg" alt="" />
      </div>
    </div>
  </body>
</html>
